<?php
namespace catchAdmin\storehouse\model\search;

trait WarehouseOutSearch
{
    //项目名称
    public function searchProjectNameAttr($query, $value, $data)
    {
        return $query->whereLike('p.project_name', $value);
    }

    //出库单号
    public function searchWarehouseOutIdAttr($query, $value, $data)
    {
        return $query->whereLike('warehouse_out_id', $value);
    }

    //客户业务单号
    public function searchCustomerBusinessNumberAttr($query, $value, $data)
    {
        return $query->whereLike('customer_business_number', $value);
    }

    //运单号
    public function searchWaybillAttr($query, $value, $data)
    {
        return $query->whereLike('waybill', $value);
    }

    //创建日期
    public function searchCreatedAtAttr($query, $value, $data)
    {
        return $query->whereBetweenTime('w.created_at', $value[0], $value[1]);
    }

    //收货方
    public function searchShipToAttr($query, $value, $data)
    {
        return $query->whereLike('ship_to', $value);
    }

    //发货方
    public function searchShipperAttr($query, $value, $data)
    {
        return $query->whereLike('shipper', $value);
    }
    public function searchStatusAttr($query, $value, $data)
    {
        return $query->where('w.status', $value);
    }
}
